package com.mmall.concurrency.example.publish;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.mmall.concurrency.annoations.NotRecommend;
import com.mmall.concurrency.annoations.NotThreadSafe;
import com.mmall.concurrency.example.atomic.AtomicExample3;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@NotThreadSafe
@NotRecommend
public class Escape {
	private static Logger log = LoggerFactory.getLogger(AtomicExample3.class);

    private int thisCanBeEscape = 0;

    public Escape(){
        new InnerClass();
    }

    private class InnerClass{
        public InnerClass(){
            log.info("{}", Escape.this.thisCanBeEscape); // 通过this， Escape还没有构造完，就可以看到它了，称为逸出
        }
    }

    public static void main(String[] args) {
        new Escape();
    }

}

